﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.Runtime.Remoting.Messaging;
using WanDa.Model;

namespace WanDa.Dal
{
    public class DbContextFactory
    {
        public static  DbContext CreateDbcontext()
        {
            DbContext dbcontext = CallContext.GetData("DbContext") as DbContext;
            if(dbcontext==null)
            {
                dbcontext = new WanDaEntities();
                CallContext.SetData("DbContext", dbcontext);
            }
            return dbcontext;
        }
    }
}
